﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseSet.Data;
using BaseSet.Logic;
using BaseSet.Entity;
using BaseSet.Framework;
using BaseSet.Entity.Common;
using BaseSet.Entity.Common.Text;
using BaseSet;
using System.Data;

namespace WebSite.UserCash
{
    public partial class CashApplyList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadContent();
            }
        }

        #region 加载内容
        private void LoadContent()
        {
            Users uinfo = UserBase.GetCurrentUser();
            CashApplyHelper cahelper = new CashApplyHelper();
            Criteria c = new Criteria();
            c.Add(CriteriaType.Equals, "UsersID", uinfo.ID);

            string[] fields = new string[] { "ID", "UsersID", "ApplyMoney", "Status", "Remark", "PayType", "PayContent", "PayDate", "CreateDate" };
            DataTable dt = cahelper.QueryCashApplyBySearchToTable(c, new Order[] { new Order("CreateDate", OrderMode.Desc) }, 0, 0, fields);

            dt.Columns.Add(new DataColumn("strStatus"));

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string status = dr["status"] + "";
                    string strstatus = "";
                    if (status == "0")
                    {
                        strstatus = "提现审批中";
                    }
                    else if (status == "1")
                    {
                        strstatus = "提现成功";
                    }
                    else if (status == "2")
                    {
                        strstatus = "提现拒绝";
                    }
                    dr["strstatus"] = strstatus;
                }
            }

            rptCashApplyList.DataSource = dt;
            rptCashApplyList.DataBind();
        }
        #endregion
    }
}